import request, { API_TOKEN_STORAGE_KEY } from './request'

export async function login(data) {
  const res = await request({
    method: 'post',
    url: 'admin/user/login',
    data
  })
  console.log(res)
  if (res) {
    localStorage.setItem(API_TOKEN_STORAGE_KEY, res)
    return res
  }else{
    throw res
  }
}
